import requests
# ihrm 登录接口对象层

# 定义ihrm登录接口类
class IhrmLoginApi(object):
    # 定义方法
    @classmethod
    def login(cls,req_data):
        resp = requests.post(url="https://ihrm-java.itheima.net/api/sys/login",
                             headers={"content-type": "application/json"},
                             json=req_data)
        return resp
# 测试接口封装
if __name__ == '__main__':
    # 准备请求体数据
    data={"mobile":"13800000002","password":"929itheima.CN032@.20250627"}
    resp = IhrmLoginApi.login(data)
    print(f"登录结果:{resp.json()}")